<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Binary angular measurement</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Binary_angular_measurement"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Binary_angular_measurement rootpage-Binary_angular_measurement skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Binary angular measurement</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p>
<b>Binary angular measurement</b> (<b>BAM</b>)<sup id="cite_ref-ship_1-0" class="reference"><a href="#cite_note-ship-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> (and the <b>binary angular measurement system</b>, <b>BAMS</b><sup id="cite_ref-BAMS_2-0" class="reference"><a href="#cite_note-BAMS-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>) is a measure of <a href="Angle" title="Angle">angles</a> using <a href="Binary_number" title="Binary number">binary numbers</a> and <a href="Fixed-point_arithmetic" title="Fixed-point arithmetic">fixed-point arithmetic</a>, in which a full <a href="Turn_(angle)" title="Turn (angle)">turn</a> is represented by the value 1. The <a href="Unit_of_measure" class="mw-redirect" title="Unit of measure">unit</a> of angular measure used in those methods may be called <b>binary radian</b> (<b>brad</b>) or <b>binary degree</b>.
</p><p>These representation of angles are often used in <a href="Numerical_control" class="mw-redirect" title="Numerical control">numerical control</a> and <a href="Digital_signal_processing" title="Digital signal processing">digital signal processing</a> applications, such as robotics, navigation,<sup id="cite_ref-lap2004_3-0" class="reference"><a href="#cite_note-lap2004-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> computer games,<sup id="cite_ref-sang1993_4-0" class="reference"><a href="#cite_note-sang1993-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> and digital sensors,<sup id="cite_ref-para2005_5-0" class="reference"><a href="#cite_note-para2005-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> taking advantage of the implicit modular reduction achieved by truncating binary numbers. It may also be used as the <a href="Fractional_part" title="Fractional part">fractional part</a> of a <a href="Fixed-point_number" class="mw-redirect" title="Fixed-point number">fixed-point number</a> counting the number of full rotations of e.g. a vehicle's wheels or a <a href="Leadscrew" title="Leadscrew">leadscrew</a>.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Representation">Representation</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Unsigned_fraction_of_turn">Unsigned fraction of turn</h3></div>
<p>In this system, an angle is represented by an <i>n</i>-<a href="Bit" title="Bit">bit</a> unsigned binary number in the sequence 0, ..., 2<sup><i>n</i></sup>−1 that is interpreted as a multiple of 1/2<sup><i>n</i></sup> of a full turn; that is, 360/2<sup><i>n</i></sup> degrees or 2π/2<sup><i>n</i></sup> radians. The number can also be interpreted as a fraction of a full turn between 0 (inclusive) and 1 (exclusive) represented in binary fixed-point format with a scaling factor of 1/2<sup><i>n</i></sup>. Multiplying that fraction by 360° or 2π gives the angle in <a href="Degree_(angle)" title="Degree (angle)">degrees</a> in the range 0 to 360, or in <a href="Radian" title="Radian">radians</a>, in the range 0 to 2π, respectively.
</p><p>For example, with <i>n</i> = 8, the binary integers (00000000)<sub>2</sub> (fraction 0.00), (01000000)<sub>2</sub> (0.25), (10000000)<sub>2</sub> (0.50), and (11000000)<sub>2</sub> (0.75) represent the angular measures 0°, 90°, 180°, and 270°, respectively.
</p><p>The main advantage of this system is that the addition or subtraction of the integer numeric values with the <i>n</i>-bit arithmetic used in most computers produces results that are consistent with the geometry of angles. Namely, the integer result of the operation is automatically reduced <a href="Modular_arithmetic" title="Modular arithmetic">modulo</a> 2<sup><i>n</i></sup>, matching the fact that angles that differ by an integer number of full turns are equivalent. Thus one does not need to explicitly test or handle the wrap-around, as one must do when using other representations (such as number of degrees or radians in floating-point).<sup id="cite_ref-harg2019_6-0" class="reference"><a href="#cite_note-harg2019-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Signed_fraction_of_turn">Signed fraction of turn</h3></div>
<p>Alternatively, the same <i>n</i> bits can also be interpreted as a signed integer in the range −2<sup><i>n</i>−1</sup>, ..., 2<sup><i>n</i>−1</sup>−1 in the <a href="Two's_complement" title="Two's complement">two's complement</a> convention. They can also be interpreted as a fraction of a full turn between −0.5 (inclusive) and +0.5 (exclusive) in signed fixed-point format, with the same scaling factor; or a fraction of half-turn between −1.0 (inclusive) and +1.0 (exclusive) with scaling factor 1/2<sup><i>n</i>−1</sup>.
</p><p>Either way, these numbers can then be interpreted as angles between −180° (inclusive) and +180° (exclusive), with −0.25 meaning −90° and +0.25 meaning +90°. The result of adding or subtracting the numerical values will have the same sign as the result of adding or subtracting angles, once reduced to this range. This interpretation eliminates the need to reduce angles to the range <span class="texhtml">[−π, +π]</span> when computing <a href="Trigonometric_functions" title="Trigonometric functions">trigonometric functions</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Example">Example</h2></div>
<p>In the orbital data broadcast by the <a href="Global_Positioning_System" title="Global Positioning System">Global Positioning System</a>, angles are encoded using binary angular measurement. In particular, each satellite broadcasts an <a href="Ephemeris" title="Ephemeris">ephemeris</a> containing its six Keplerian <a href="Orbital_elements" title="Orbital elements">orbital elements</a>. Four of these are angles, which are encoded as 32-bit binary angles. In the lower-precision <a href="GPS_signals#Almanac" title="GPS signals">almanac</a> data, 24-bit binary angles are used.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Grade_(angle)" class="mw-redirect" title="Grade (angle)">Grade</a>, 1/400 of a full turn</li>
<li><a href="Binary_scaling" class="mw-redirect" title="Binary scaling">Binary scaling</a></li>
<li><a href="CORDIC" title="CORDIC">CORDIC</a>, algorithms for trigonometric functions</li>
<li><a href="Constructible_polygon" title="Constructible polygon">Constructible polygon</a>, including all polygons with 2<sup><i>n</i></sup> sides</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-ship-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-ship_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20091221160257/http://www.tpub.com/content/fc/14100/css/14100_314.htm">"Binary angular measurement"</a>. Archived from <a rel="nofollow" class="external text" href="http://www.tpub.com/content/fc/14100/css/14100_314.htm">the original</a> on 2009-12-21.</cite></span>
</li>
<li id="cite_note-BAMS-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-BAMS_2-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://acronyms.thefreedictionary.com/Binary+Angular+Measurement+System">"Binary Angular Measurement System"</a>. <i>acronyms.thefreedictionary</i>.</cite></span>
</li>
<li id="cite_note-lap2004-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-lap2004_3-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFLaPlante2004" class="citation book cs1">LaPlante, Phillip A. (2004). <a rel="nofollow" class="external text" href="http://www.globalspec.com/reference/14722/160210/Chapter-7-5-3-Binary-Angular-Measure">"Chapter 7.5.3, Binary Angular Measure"</a>. <i>Real-Time Systems Design and Analysis</i>. Wiley. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-471-22855-9</bdi>.</cite></span>
</li>
<li id="cite_note-sang1993-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-sang1993_4-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFSanglard2010" class="citation web cs1">Sanglard, Fabien (2010-01-13). <a rel="nofollow" class="external text" href="http://fabiensanglard.net/doomIphone/doomClassicRenderer.php">"Doom 1993 code review - Section "Walls""</a>. <i>fabiensanglard.net</i>.</cite></span>
</li>
<li id="cite_note-para2005-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-para2005_5-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20110711172521/http://www.hobbyengineering.com/specs/PX-29123.pdf">"Hitachi HM55B Compass Module (#29123)"</a> <span class="cs1-format">(PDF)</span>. <i>www.hobbyengineering.com</i>. Parallax Digital Compass Sensor (#29123). <a href="Parallax%2C_Inc._(company)" class="mw-redirect" title="Parallax, Inc. (company)">Parallax, Inc.</a> May 2005. Archived from <a rel="nofollow" class="external text" href="http://www.hobbyengineering.com/specs/PX-29123.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 2011-07-11 – via www.parallax.com.</cite></span>
</li>
<li id="cite_note-harg2019-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-harg2019_6-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFHargreaves" class="citation web cs1 cs1-prop-interwiki-linked-name"><a href="https://pl.wikipedia.org/wiki/Shawn_Hargreaves" class="extiw external" title="pl:Shawn Hargreaves">Hargreaves, Shawn</a> <span class="cs1-format">[in Polish]</span>. <a rel="nofollow" class="external text" href="http://blogs.msdn.com/shawnhar/archive/2010/01/04/angles-integers-and-modulo-arithmetic.aspx">"Angles, integers, and modulo arithmetic"</a>. blogs.msdn.com. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190630223817/http://www.shawnhargreaves.com/blogindex.html">Archived</a> from the original on 2019-06-30<span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-05</span></span>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-11-02" href="https://en.wikipedia.org/wiki/?title=Binary_angular_measurement&oldid=1254884808">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>